<?php
/**
 * sendMail()
 *
 * @param array $aMail
 * @return
 */
function sendMail($aMail = array())
{
    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->CharSet = "utf-8";
    $mail->Encoding = "base64";
    $mail->Host = $aMail['host']; // SMTP server
    $mail->From = $aMail['from'];
    $mail->FromName = $aMail['fromName'];
    $mail->Subject = $aMail['subject'];
    $mail->Body = $aMail['body'];
    $mail->AltBody = $aMail['altBody']; // optional, comment out and test
    $mail->AddAddress($aMail['address'], $aMail['recipient']);
    $mail->AddAttachment($aMail['attachment']);
    if (!$mail->Send()) {
        echo "Message could not be sent. <p>";
        echo "Mailer Error: " . $mail->ErrorInfo;
        exit;
    }
}
/**
 * sendRegisterMail()
 *
 * @param string $recipient
 * @return
 */
function sendRegisterMail($sAddress = "", $sUsername = "", $sPassword = "")
{
    $aMail = array();
    $aMail['host'] = ZEUS_SMTP;
    $aMail['from'] = ZEUS_EMAIL;
    $aMail['fromName'] = _e("The SmartVision Develop Term");
    $aMail['address'] = $sAddress;
    $aMail['recipient'] = $sUsername;
    $aMail['subject'] = _e("New SmartVision Account");
    $aMail['body'] = "<html><head><meta http-equiv='content-type' content='text/html; charset=utf-8'></head><body>"
     . _e("Hello") . " " . $sUsername . "!<br />\n<br />"
     . _e("Your new account has been successfully registered at:") . "<br />\n<br />"
     . "<a href='http://" . ZEUS_URL . "'>http://" . ZEUS_URL . "</a><br />\n<br />"
     . _e("You can log in to the new account with the following information:") . "<br />\n<br />"
     . _e("Username:") . "\t" . $sUsername . "<br />\n<br />"
     . _e("Password:") . "\t" . $sPassword . "<br />\n<br />"
     . _e("We hope you enjoy your new experience. Thanks!") . "<br />\n<br />\t -- "
     . _e("The SmartVision Develop Term") . "<br />\n<br />"
     . "<a href='mailto:" . ZEUS_EMAIL . "'>" . ZEUS_EMAIL . "</a><br />\n<br />"
     . "</body></html>";
    sendMail($aMail);
}

?>